import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      '@': '/src'
    }
  },
  server: {
    proxy: {

      "/xmly": {

        target: "https://m.ximalaya.com",

        changeOrigin: true, //表示是否跨域，

        rewrite: (path) => path.replace(/^\/xmly/, '')
      },
      "/huoqu": {

        target: "https://m.ximalaya.com",

        changeOrigin: true, //表示是否跨域，

        rewrite: (path) => path.replace(/^\/huoqu/, ''),

        headers: {
          "Cookie": '1&_token=242737097&88AE8540340N8346E718D9A25FB2E94BACB5B1378420DFAB54A1B1B403BD2FDFAB55E9960D2E148MB42A86B57E2D67F_'
        }
      },
      "/jekoer": {

        target: "https://search.ximalaya.com",

        changeOrigin: true, //表示是否跨域，

        rewrite: (path) => path.replace(/^\/jekoer/, '')
      },
      "/denglu": {

        target: "http://sph-h5-api.atguigu.cn",

        changeOrigin: true, //表示是否跨域，

        rewrite: (path) => path.replace(/^\/denglu/, '')
      },
    }
  }
})
